<template>
	<view>
		<navbar title="工具栏目" leftIcon=" " :autoBack="false"></navbar>
		<u-loading-page :loading="loading"></u-loading-page>
		<scroll-view scroll-y="true" class="scbox" v-if="!loading">
			<view class="con">
				<view class="u-flex u-flex-y-center u-flex-between u-flex-wrap">
					<view class="con__item" v-for="(item,index) in gjlist" :key="index" @click="navto('/pages/tool/'+item.url)">
						<view class="con__item__name">
							{{item.name}}
						</view>
						<view class="con__item__lj">
							立即进入
						</view>
						<image src="/static/homex/more1.png" class="con__item__more" mode=""></image>
						<image :src="'/static/homex/'+item.icon+'.png'" class="con__item__icon" :style="item.style"
							mode=""></image>
					</view>
				</view>
				<!-- 工作量 -->
				<view class="con__workload">
					<view class="con__workload__title" @click="navto('/pages/tool/workstatistics')">
						<view class="con__workload__title__line">

						</view>
						<view class="con__workload__title__text">
							我的工作统计
						</view>
						<image src="/static/homex/more2.png" class="con__workload__title__more" mode=""></image>
					</view>
					<view class="u-flex u-flex-xy-center">
						<view class="con__workload__item">
							<view class="con__workload__item__num c24a">
								{{homeindex.newCustomer}}
							</view>
							<view class="con__workload__item__text">
								新增客户数
							</view>
						</view>
						<view class="con__workload__item">
							<view class="con__workload__item__num c304">
								{{homeindex.totalCustomer}}
							</view>
							<view class="con__workload__item__text">
								客户总数
							</view>
						</view>
						<view class="con__workload__item">
							<view class="con__workload__item__num cfd7">
								{{homeindex.contactCustomer}}
							</view>
							<view class="con__workload__item__text">
								联系客户数
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<tabbar :current="0"></tabbar>
	</view>
</template>

<script>
	import home from '@/api/_home.js'
	export default {
		data() {
			return {
				loading:true,
				gjlist: [{
						name: '外勤签到',
						icon: 'wq',
						style: "width: 83rpx;height: 78rpx;right: 25rpx;bottom: 29rpx;",
						url: 'sign'
					},
					{
						name: '工作汇报',
						icon: 'hb',
						style: "width: 77rpx;height: 80rpx;right: 33rpx;bottom: 27rpx;",
						url: 'report'
					},
					{
						name: '审批',
						icon: 'sp',
						style: "width: 77rpx;height: 75rpx;right: 25rpx;bottom: 33rpx;",
						url: 'approval'
					},
					{
						name: '任务',
						icon: 'wq',
						style: "width: 79rpx;height: 76rpx;right: 27rpx;bottom: 26rpx;",
						url: 'tasklist'
					},
				],
				homeindex:{}
			};
		},
		onLoad() {
			uni.hideTabBar()
		},
		onShow() {
			this.getindex()
		},
		methods:{
			async getindex(){
				let res=await home.saleindex()
				if(res.data.code==1){
					this.homeindex=res.data.data
					this.loading=false
				}
			}
		}
	}
</script>

<style lang="scss">
	.scbox {
		background-color: #f8f8f8;
		height: calc(100vh - var(--status-bar-height) - 44px - 146rpx);
	}

	.con {
		padding: 10rpx 30rpx;

		&__item {
			width: 337rpx;
			height: 229rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			position: relative;
			margin-bottom: 23rpx;

			&__name {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 29rpx;
				color: #000000;
				line-height: 28rpx;
				padding: 44rpx 0 16rpx 39rpx;
			}

			&__lj {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #AAAAAA;
				line-height: 24rpx;
				padding: 0 0 36rpx 39rpx;
			}

			&__more {
				width: 31rpx;
				height: 31rpx;
				margin-left: 39rpx;
				// margin-bottom: 39rpx;
			}

			&__icon {
				position: absolute;
			}
		}

		&__workload {
			padding: 37rpx 0 67rpx;
			background: #FFFFFF;
			border-radius: 20rpx;

			&__title {
				padding: 0 36rpx 66rpx 24rpx;
				display: flex;
				align-items: center;

				&__line {
					width: 6rpx;
					height: 27rpx;
					background: #3262FD;
				}

				&__text {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #010101;
					line-height: 26rpx;
					flex: 1;
					margin-left: 10rpx;
				}

				&__more {
					width: 15rpx;
					height: 25rpx;
				}
			}

			&__item {
				width: 33.33%;
				text-align: center;

				&__num {
					font-family: PingFang SC;
					font-weight: 800;
					font-size: 42rpx;
					color: #24A050;
					line-height: 32rpx;
				}

				&__text {
					margin-top: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #7A7A7A;
					line-height: 23rpx;
				}

				.c24a {
					color: #24A050;
				}

				.c304 {
					color: #3049F6;
				}

				.cfd7 {
					color: #FD7A32;
				}
			}
		}
	}
</style>